package com.zl.gmadmin.controller;

import cn.hutool.json.JSONUtil;
import com.zl.gmadmin.common.DPlayerConstants;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: ZhangLiang
 * @Date: 2021/08/20/16:48
 * @Description:  弹幕的controller，全是静态数据
 */
@RestController
@RequestMapping(value = "barrage")
public class BarrageController {

    @GetMapping(value = "v3")
    public String getV3(@RequestParam String id) {
        System.out.println(id);
        Map map = new HashMap();
        List data = new ArrayList();
        data.add(DPlayerConstants.barrage_init(new DPlayerConstants(0.00,0, 16777215L,"DIYgod","一条弹幕")));
        data.add(DPlayerConstants.barrage_init(new DPlayerConstants(15.926367,0, 16777215L,"DIYgod","2条弹幕")));
        data.add(DPlayerConstants.barrage_init(new DPlayerConstants(15.926367,0, 16777215L,"DIYgod","3条弹幕")));
        data.add(DPlayerConstants.barrage_init(new DPlayerConstants(15.926367,0, 16777215L,"DIYgod","4条弹幕")));
        data.add(DPlayerConstants.barrage_init(new DPlayerConstants(2.393571,0, 16711935L,"DIYgod","5条弹幕")));
        data.add(DPlayerConstants.barrage_init(new DPlayerConstants(2.393571,0, 16711935L,"DIYgod","6条弹幕")));
        data.add(DPlayerConstants.barrage_init(new DPlayerConstants(2.393571,0, 16711935L,"DIYgod","7条弹幕")));
        data.add(DPlayerConstants.barrage_init(new DPlayerConstants(2.393571,0, 16711935L,"DIYgod","8条弹幕")));
        data.add(DPlayerConstants.barrage_init(new DPlayerConstants(3.393571,0, 12326679L,"DIYgod","9条弹幕")));
        data.add(DPlayerConstants.barrage_init(new DPlayerConstants(3.393571,0, 12326679L,"DIYgod","10条弹幕")));
        data.add(DPlayerConstants.barrage_init(new DPlayerConstants(3.393571,0, 12326679L,"DIYgod","11条弹幕")));
        data.add(DPlayerConstants.barrage_init(new DPlayerConstants(4.926367,0, 12326679L,"DIYgod","12条弹幕")));
        data.add(DPlayerConstants.barrage_init(new DPlayerConstants(4.926367,0, 12326679L,"DIYgod","13条弹幕")));
        data.add(DPlayerConstants.barrage_init(new DPlayerConstants(4.926367,0, 16711680L,"DIYgod","14条弹幕")));
        data.add(DPlayerConstants.barrage_init(new DPlayerConstants(5.926367,0, 16711680L,"DIYgod","15条弹幕")));
        data.add(DPlayerConstants.barrage_init(new DPlayerConstants(5.926367,0, 16711680L,"DIYgod","16条弹幕")));
        data.add(DPlayerConstants.barrage_init(new DPlayerConstants(5.926367,0, 16711680L,"DIYgod","17条弹幕")));
        data.add(DPlayerConstants.barrage_init(new DPlayerConstants(10.926367,0, 65280L,"DIYgod","18条弹幕")));
        data.add(DPlayerConstants.barrage_init(new DPlayerConstants(14.926367,0, 65280L,"DIYgod","19条弹幕")));
        data.add(DPlayerConstants.barrage_init(new DPlayerConstants(18.926367,0, 65280L,"DIYgod","20条弹幕")));


        map.put("code", DPlayerConstants.DPLAYER_SUCCESS_CODE);
        map.put("data",data);

        System.out.println(JSONUtil.toJsonStr(map));
        return JSONUtil.toJsonStr(map);
    }
}
